/*
 * @(#)MemberDAOImpl.java $version 2013-3-4
 * 
 * Copyright 2013 NADO Group. All rights Reserved.
 * NADO PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.nado.iims2.community.dao.impl;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.nado.extensions.sql.SimpleSqlMapDaoSupport;
import com.nado.extensions.util.DataMap;
import com.nado.iims2.community.dao.MemberDAO;
import com.nado.iims2.community.model.MemberModel;

/**
 * The Class MemberDAOImpl.
 * 
 * @author nado
 */
@Repository("MemberDAO")
public class MemberDAOImpl extends SimpleSqlMapDaoSupport implements MemberDAO {
	/** The Constants PREFIX. */
	private final static String PREFIX = "com.nado.iims2.community.member.";
	
	@Override
	public List<DataMap> selectMemberList(String startDate, String endDate,
			String searchText, int offset, int count) throws SQLException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("startDate", startDate);
		params.put("endDate", endDate);
		params.put("searchText", searchText);
		params.put("offset", offset);
		params.put("count", count);
		
		return getSqlMapClient().queryForList(PREFIX + "selectMemberList", params);
	}

	@Override
	public int selectMemberListCount(String startDate, String endDate,
			String searchText) throws SQLException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("startDate", startDate);
		params.put("endDate", endDate);
		params.put("searchText", searchText);
		
		return (Integer) getSqlMapClient().queryForObject(PREFIX + "selectMemberListCount", params);
	}

	@Override
	public MemberModel selectMemberDetail(String memberId) throws SQLException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("memberId", memberId);
		
		return (MemberModel) getSqlMapClient().queryForObject(PREFIX + "selectMemberDetail", params);
	}
	
	@Override
	public int deleteMember(String memberId) {
		return 0;
	}
}
